1. Field of the Invention
The present invention relates to an image encoding method, an image decoding method, an image encoding apparatus, an image decoding apparatus, an image processing system, an image encoding program, and an image decoding program capable of implementing efficient entropy coding of orthogonal transform coefficients in an orthogonal transform permitting selection among multiple block sizes.
2. Related Background Art
Encoding techniques of image signals are used for transmission and for accumulation and reproduction of image signals of still images, moving images, and so on. Such techniques include known international standard encoding methods, e.g., ISO/IEC International Standard 10918 (hereinafter referred to as JPEG) as an encoding technique for still images, and ISO/IEC international Standard 14496-2 (MPEG-4 Visual, which will be referred to hereinafter as MPEG-4) as an encoding technique for moving images. A newer known encoding method is ITU-T Recommendation H.264; ISO/IEC International Standard 14496-10 (Joint Final Committee Draft of Joint Video Specification, ftp//ftp.imtc-files.org/jvt-experts/2002 07 Klagenfurt/JVT-D157.zip, which will be referred to hereinafter as H.26L), which is a video coding method intended for joint international standardization by ITU-T and ISO/IEC.
Image signals demonstrate close correlations between spatially neighboring pixels and thus transformation into the frequency domain leads to deviation of information to the low frequency region, which enables reduction of redundancy by making use of the deviation. Therefore, the typical image encoding methods adopt a technique of subjecting image signals to an orthogonal transform to transform them into orthogonal transform coefficients in the frequency domain, so as to achieve deviation of signal components to the low frequency region. Furthermore, the coefficient values are quantized so that small-valued coefficients are converted into zeros. A coefficient string is made by reading the coefficients in order from the lowest in the low frequency region and is subjected to entropy coding taking advantage of the deviation of coefficient values, thus achieving efficient encoding with reduction of redundancy.
In this case, the Discrete Cosine Transform (DCT) is commonly used as the orthogonal transform in terms of encoding efficiency and ease of implementation. The orthogonal transform such as the DCT is carried out in units of blocks resulting from division of image signals into blocks each consisting of a plurality of pixels. The size of the blocks, as well as the property of the image signals, largely affects the encoding efficiency.
When image signals demonstrate only small change in the spatial property, image signals to be transformed into orthogonal transform coefficients in a narrow frequency region are widely distributed on an image, and the redundancy can be reduced more with increase in the size of the blocks, i.e., the size of the orthogonal transform, so as to increase the encoding efficiency, as compared with cases using smaller blocks, which raise the need for repeatedly expressing identical orthogonal transform coefficients. When image signals demonstrate large change in the spatial property on the other hand, the increase in the size of blocks results in obtaining various frequency components of orthogonal transform coefficients thereof and thus decreasing the deviation of coefficients, which makes efficient entropy coding difficult and thus decreases the encoding efficiency.
In order to take advantage of the change of encoding efficiency due to the changes in the sizes of the blocks for the orthogonal transform and the property of image signals, the technology utilized is one of preparing orthogonal transform means in a plurality of block sizes in advance and adaptively selecting and using a size achieving the best encoding efficiency out of them. This technology is called Adaptive Block size Transforms (ABT) and is adopted in H.26L. FIGS. 1A-FIG. 1E show orthogonal transform blocks used for the ABT in H.26L. The ABT permits a size achieving the best encoding efficiency to be selected out of four types of orthogonal transform block sizes shown in FIGS. 1B-1E, for each macroblock of 16×16 pixels shown in FIG. 1A. Pixel values of each macroblock are equally divided in units of blocks of the selected size and are then subjected to the orthogonal transform. By implementing such selection, it becomes feasible to achieve efficient reduction of redundancy through the use of the orthogonal transform in accordance with the change in the spatial property of image signals in the macroblocks. Reference should be made to H.26L as to more specific details of the ABT.
The entropy coding for the orthogonal transform coefficients obtained by the orthogonal transform is effected on a coefficient string obtained by sequentially reading the orthogonal transform coefficients from the lowest in the low frequency region. FIG. 2A shows an order of reading coefficients in an orthogonal transform block of 4×4 pixels. Since the coefficients obtained by the orthogonal transform are arranged with the lowest frequency component (i.e., the dc component) at the left upper corner, the coefficients are read out in order from the left upper coefficient to obtain a coefficient string consisting of sixteen coefficients as shown in FIG. 2B. This reading order is called zig-zag scan.
The coefficients obtained by the orthogonal transform are noncorrelated with each other, and the signal components deviate to the low frequency region. For this reason, when they are further quantized, the lower frequency coefficients are more likely to be nonzero coefficient values, so that many zero-valued coefficients appear in the coefficient string. For example, it produces a sequence of coefficient values as shown in FIG. 2C. Therefore, for efficient entropy coding of the coefficient string of this distribution, it is common practice in encoding of images to perform the encoding by expressing the coefficient string by the numbers of continuous zero coefficients preceding a nonzero coefficient (runs) and coefficient values (levels) of the nonzero coefficients. Such encoding with runs and levels is also used in the entropy coding of orthogonal transform coefficients by the ABT.
On the other hand, in order to increase the efficiency more in the entropy coding as described above, H.26L employs the technology called Context-based Adaptive Variable Length Code (CAVLC), which is applied to the orthogonal transform without the use of the ABT, i.e., to cases where the orthogonal transform is always carried out in units of orthogonal transform blocks of 4×4 pixels.
The CAVLC in H.26L utilizes the following features: the maximum number of coefficients in the coefficient string obtained from each orthogonal transform block of 4×4 pixels is 16, the magnitude of runs is restricted by this maximum number, and the magnitude of levels tends to be larger at lower frequencies. A number of encoding tables used in variable length encoding are prepared as optimized tables for respective conditions, and they are applied while sequentially being switched, so as to increase the encoding efficiency.
For example, in the case where runs are encoded in order, the first run can take a variety of values from 0 to 14 (according to the definition of runs in H.26L, the maximum value of runs is 14, which is two smaller than the total number of coefficients). On the other hand, a run appearing in the last stage of the sequential encoding of runs can take only one of limited run values, because there is the upper limit to the number of coefficients in the coefficient string. Accordingly, as shown in FIG. 3, the right-side encoding table with the largest number of elements in the encoding table is applied to runs appearing in the initial stage, and the left-side encoding tables with the smaller number of elements in each encoding table are applied to runs appearing in the last stage. This permits assignment of codes of smaller bit counts and thus implements efficient entropy coding. The CAVLC achieves the efficient encoding by making use of the conditions such as the maximum number of coefficients in each block and placing restrictions on the range where values to be encoded can take. Reference should be made to H.26L as to more specific details of the CAVLC.